﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

#include <QMainWindow>
#include <QMessageBox>
#include <iostream>
#include <QtConcurrent>
#include <Windows.h>
#include <QSerialPort>        //提供访问串口的功能
#include <QSerialPortInfo>    //提供系统中存在的串口的信息
#include <SerialPort.h>

using namespace std;

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void read();
    bool m_bolIsOpen;

private slots:
    void on_pushButton_clicked();

    void serialPort_readyRead();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

private:
    Ui::MainWindow *ui;
    QSerialPort serial;
    HANDLE handle;
    CSerialPort gSerialPort;

    void open();
    void write();
    void DispText();
};
#endif // MAINWINDOW_H
